package org.example.forum.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.forum.common.AppResult;
import org.example.forum.exception.ApplicationException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
@Tag(name = "/clients")
public class Test {

    @Operation(summary = "This method is used to get the clients.")
    @GetMapping("/hello")
    public String test(){
        return "hello";
    }
    @GetMapping("/exception")
    public AppResult exception() throws Exception {
        throw new Exception("这是一个exception");
    }
    @GetMapping("/appexception")
    public AppResult appException(){
        throw new ApplicationException("这是一个自定义异常");
    }
}
